﻿/*
 * Copyright (C) 2023 - 2024 lchfj.cn
 * 
 * This file is part of FastestHost.
 * 
 * FastestHost is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 * 
 * FastestHost is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License along with FastestHost. If not, see <https://www.gnu.org/licenses/>.
 */

using System.Text.Json;
using System.Text.Json.Serialization;

namespace Cn.Lchfj.FastestHost
{
    [JsonSerializable(typeof(HostIPTestResult))]
    [JsonSourceGenerationOptions(JsonSerializerDefaults.Web)]
    internal partial class HostIPTestResultJsonContext : JsonSerializerContext
    {

    }
    /// <summary>
    /// 主机地址测试用时
    /// </summary>
    internal record HostIPTestResult : HostIP
    {
        public HostIPTestResult()
        {
            Time = 0;
        }

        public HostIPTestResult(HostIP host, long time) : base(host)
        {
            Time = time;
        }

        /// <summary>
        /// 请求耗时
        /// </summary>
        public long Time { get; init; }
    }
}
